package model;

import java.sql.ResultSet;

public class TDrug {
    private int drugid;      //药品ID
    private String name;     //药品名字
    private String img;      //药品图片
    private String drugclass;//药品类别
    private String cureclass;//治疗类别
    private String drugsize; //药品规格
    private String fexplain; //功效说明
    private String merchant; //厂家
    private int price;       //价格
    private String userid;   //所属管理

    public TDrug() {

    }

    @Override
    public String toString() {
        return "TDrug{" +
                "drugid=" + drugid +
                ", name='" + name + '\'' +
                ", img='" + img + '\'' +
                ", drugclass='" + drugclass + '\'' +
                ", cureclass='" + cureclass + '\'' +
                ", drugsize='" + drugsize + '\'' +
                ", fexplain='" + fexplain + '\'' +
                ", merchant='" + merchant + '\'' +
                ", price=" + price +
                ", userid='" + userid + '\'' +
                '}';
    }

    public TDrug(int drugid, String name, String img, String drugclass, String cureclass, String drugsize, String fexplain, String merchant, int price, String userid) {
        this.drugid = drugid;
        this.name = name;
        this.img = img;
        this.drugclass = drugclass;
        this.cureclass = cureclass;
        this.drugsize = drugsize;
        this.fexplain = fexplain;

        this.merchant = merchant;
        this.price = price;
        this.userid = userid;
    }

    public TDrug(ResultSet rs){
        try{
            if(rs!=null && rs.next()){
                this.setDrugid(rs.getInt("drugid"));
                this.setName(rs.getString("name"));
                this.setImg(rs.getString("img"));
                this.setDrugclass(rs.getString("drugclass"));
                this.setCureclass(rs.getString("cureclass"));
                this.setDrugsize(rs.getString("drugsize"));
                this.setFexplain(rs.getString("fexplain"));

                this.setMerchant(rs.getString("merchant"));
                this.setPrice(rs.getInt("price"));
                this.setUserid(rs.getString("userid"));
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public int getDrugid() {
        return drugid;
    }

    public void setDrugid(int drugid) {
        this.drugid = drugid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getDrugclass() {
        return drugclass;
    }

    public void setDrugclass(String drugclass) {
        this.drugclass = drugclass;
    }

    public String getCureclass() {
        return cureclass;
    }

    public void setCureclass(String cureclass) {
        this.cureclass = cureclass;
    }

    public String getDrugsize() {
        return drugsize;
    }

    public void setDrugsize(String drugsize) {
        this.drugsize = drugsize;
    }

    public String getFexplain() {
        return fexplain;
    }

    public void setFexplain(String fexplain) {
        this.fexplain = fexplain;
    }

    public String getMerchant() {
        return merchant;
    }

    public void setMerchant(String merchant) {
        this.merchant = merchant;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }
}
